<template>
    <div id="app">
        <el-button @click="dialogTableVisibleBtn">打开表格 Dialog</el-button>
        <el-button @click="dialogFormVisibleBtn">打开表单 Dialog</el-button>
        <el-button @click="modalDialogVisibleBtn">打开普通 Dialog</el-button>
        <el-button @click="submitForm">保存</el-button>
        <complex-table
                :gridTable="gridTable"
                :gridColumn="gridColumn"
                :gridData="gridData"
                :paginationInfo="paginationInfo"
                @getStringInputFocus="getStringInputFocus"
                @get-table-data="getTableData"
                @get-table-current-change = 'handleTableCurrentChange'
                :spanMethod="spanMethod"
                :rowClassName="rowClassName"
                :selectionTables="selectionTables"
        ></complex-table>

        <complex-form
                ref="formItem"
                :key="formKey"
                :formInfo="formInfo"
                :formItem="formItem"
                @get-form-data="getFormData"
                @get-string-input-focus="getStringInputFocusForm"
                @on-submit="onSubmit"
        ></complex-form>
        <complex-query
                ref="formItem"
                :formInfo="formInfo"
                :formItem="formItem"
                @get-form-data="getFormData"
                @get-string-input-focus="getStringInputFocusForm"
                @on-submit="onSubmit"
        ></complex-query>
        <div>
            <el-button size="mini" type="primary" @click="onSubmit(formItem)">保存</el-button>
            <el-button size="mini" @click="resetBtn(formItem)">清空</el-button>
        </div>
        <!--<table-text
                ref="tableText"
                :gridTable="gridTable"
                :gridColumn="gridColumn"
                :gridData="gridData"
                :paginationInfo="paginationInfo"
                @get-table-data="getTableData"
        ></table-text>-->
        <!--普通弹框-->
        <h3>普通弹框</h3>
        <modal-dialog
                :title="modalTitle"
                :gridData="gridData"
                :dialogVisible="dialogVisible"
                @getd-dialog-data="modalDialogData"
                @modal-dialog-visible="modalDialogVisible"
        >
            <template v-slot:body>
                <table-text
                        ref="tableText"
                        :gridTable="gridTable"
                        :gridColumn="gridColumn"
                        :gridData="gridData"
                        :paginationInfo="paginationInfo"
                        @get-table-data="getTableData"
                >
                </table-text>
            </template>
        </modal-dialog>
        <!--弹框-&#45;&#45;表格列表：table-->
        <!--<modal-table
                :title="modalTitle"
                :gridTable="gridTable"
                :gridColumn="gridColumn"
                :gridData="gridData"
                :dialogTableVisible="dialogTableVisible"
                :paginationInfo="paginationInfo"
                @getd-dialog-table-data="modalTableData"
                @dialog-table-visible="modalTableVisible"
        >
        </modal-table>-->
        <!--弹框-&#45;&#45;form表格-->
        <modal-form
                :title="modalTitle"
                :formInfo="formInfo"
                :formItem="formItem"
                :dialogFormVisible="dialogFormVisible"
                @dialog-form-visible="modalFormVisible"
                @get-dialog-form-data="modalFormData"
        >
        </modal-form>
    </div>
</template>

<script>
    // import HelloWorld from './components/HelloWorld.vue'
    // import ComplexTable from '../packages/Table/src/ComplexTable'
    import TableText from '../packages/Table/src/TableText'
    import ComplexTable from '../packages/Table/src/ComplexTable'
    import ComplexForm from '../packages/Form/src/ComplexForm'
    import ModalDialog from '../packages/Modal/src/ModalDialog'
    import ModalForm from '../packages/Modal/src/ModalForm'
    // import ModalTable from '../packages/Modal/src/ModalTable'
    import ComplexQuery from '../packages/Form/src/ComplexQuery'


    export default {
        name: 'app',
        components: {
            ComplexForm,
            ComplexTable,
            TableText,
            ModalDialog,
            ModalForm,
            // ModalTable
            ComplexQuery,
        },
        data() {
            /*var validateName1 = (rule, value, callback) => {
                console.log(rule, value, callback);
                console.log(this.formItem[0].value)
                if (!this.formItem[0].value) {
                    callback(new Error('请输入'));
                }

                // if (value === '') {
                //     callback(new Error('请输入密码'));
                // } else {
                //     if (this.ruleForm.checkPass !== '') {
                //         this.$refs.ruleForm.validateField('checkPass');
                //     }
                //     callback();
                // }
            };*/
            return {
                formKey: new Date().getTime(),
                modalTitle: '测试弹框',
                key: 0,
                gridColumn: [
                    {
                        label: '选择',
                        key: 'radioItem',
                        property: 'radioItem',
                        type: 'selection',
                    },
                    {
                        label: '性别',
                        key: 'sex',
                        property: 'sex',
                        type: 'select',
                        attributes: {
                            options: [
                                {
                                    label: "男",
                                    value: "0"
                                }, {
                                    label: "女",
                                    value: "1"
                                }
                            ]
                        }
                    }, {
                        label: '日期',
                        key: 'date',
                        property: 'date',
                        // width: 260,
                        type: 'datePicker',
                    },
                    {
                        label: '姓名',
                        key: 'name',
                        property: 'name',
                        type: 'cascader',
                        attributes:{
                            ref: 'cascader-data',
                            clearable:true,
                            filterable:true,
                            showAllLevels: false,
                            multiple: {
                                checkStrictly: false
                            },
                            options: [
                                {
                                    label: '123',
                                    value: '1',
                                    children:[
                                        {
                                            label: 'qwe',
                                            value: 'qwe',
                                        }
                                    ]
                                },
                                {
                                    label: '456',
                                    value: '1'
                                }
                            ]
                        },
                    },
                    {
                        label: '地址',
                        key: 'address',
                        property: 'address',
                        width: 100,
                        type: '',
                    },
                    {
                        label: '地址1',
                        key: 'num',
                        property: 'num',
                        type: 'button',
                        controls: true,
                        precision: 2
                    },
                    {
                        label: '图片',
                        key: 'img',
                        property: 'img',
                        type: 'images',
                        width: 80,
                        attributes: {}
                    }
                ],
                gridTable: {
                    stripe: false,
                    border: true,
                    selection: false,
                    height: "initial",
                    maxHeight: "680",
                    // arraySpanMethod: this.spanMethod()
                },
                gridData: [
                    {
                        radioItem: 0,
                        sex: '1',
                        date: '',
                        name: '王小虎',
                        address: '上海市普陀区金沙江路 1518 弄',
                        num: [
                            {
                                type: 'primary',
                                size: 'mini',
                                value: '确定'
                            },{
                                type: 'primary',
                                size: 'mini',
                                value: '取消'
                            },{
                                type: 'warning',
                                size: 'mini',
                                value: '删除'
                            }

                        ],
                        img: ''

                    },
                    {
                        radioItem: 0,
                        sex: '1',
                        date: '2016-05-04',
                        name: '张三',
                        address: '上海市普陀区金沙江路',
                        num: 0,
                        img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    },
                    {
                        radioItem: 0,
                        sex: '0',
                        date: '2016-05-01',
                        name: '李四',
                        address: '上海市普陀区',
                        num: 0,
                        img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    },
                    {
                        radioItem: 0,
                        sex: '0',
                        date: '2016-05-03',
                        name: '王五',
                        address: '上海市',
                        num: 0,
                        img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    },
                    {
                        radioItem: 0,
                        sex: '0',
                        date: '2016-05-03',
                        name: '王五',
                        address: '上海市',
                        num: 0,
                        img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    },
                    // {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    // },
                    // {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    // },
                    // {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '1231312',
                    //     num: 0,
                    //     img: "https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg"
                    // },


                    // {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }, {
                    //     radioItem: 0,
                    //     sex: '0',
                    //     date: '2016-05-03',
                    //     name: '王五',
                    //     address: '上海市',
                    //     num: 0,
                    //     img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
                    // }
                ],
                paginationInfo: {
                    layout: 'total, sizes, prev, pager, next, jumper',
                    paginationTitle: '',
                    pageSizes: [10, 20, 30, 40, 50, 100],
                    pageSize: 10,
                    total: 240,
                    currentPage: 1,
                },
                formInfo: {
                    form: {
                        name: 'forms',
                        inline: true,
                        region: '',
                        labelWidth: '300px',
                        date1: '',
                        date2: '',
                        delivery: false,
                        type: [],
                        resource: '',
                        desc: '',
                        rules: '',
                        ref: 'ruleForm',
                        disabled: true,
                    },
                },
                formItem: [
                    {
                        field: 'name',
                        label: '输入框-1',
                        labelWidth: '100px',
                        inputWidth: '180px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        prop: 'name1',
                        rules: [
                            { required: true,validator: this.validateName, trigger: 'blur' ,message: '请输入'}
                            // { required: true,validator: validateName1, trigger: 'blur' }
                        ],
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'stringInput',
                        attributes:{
                            // disabled: true
                        },
                        value: '132',

                    },
                    {
                        field: 'a2',
                        label: '输入框0',
                        labelWidth: '130px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        prop: 'name',
                        rules: [
                            { required: true, message: '请输入', trigger: 'blur' },
                            { min: 10, max: 15, message: '长度在 3 到 15 个字符', trigger: 'blur' }
                        ],
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'noneInput',
                        attributes:{
                            // disabled: true
                        },
                        value: '',

                    },
                    {
                        field: 'a3',
                        label: '输入框1',
                        labelWidth: '130px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        rules: '',
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'textInput',
                        attributes:{
                            // disabled: true
                        },
                        value: '11111111',

                    },
                    {
                        field: 'a4',
                        label: '输入框2',
                        labelWidth: '130px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        rules: '',
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'cascader',
                        attributes:{
                            // disabled: true,
                            ref: 'cascader-data',
                            clearable:true,
                            filterable:true,
                            showAllLevels: false,
                            multiple: {
                                checkStrictly: false
                            },
                            options: [
                                {
                                    label: '123',
                                    value: '1',
                                    children:[
                                        {
                                            label: 'qwe',
                                            value: 'qwe',
                                            children:[
                                                {
                                                    label: 'qwe1233',
                                                    value: 'qwe123',
                                                },
                                                {
                                                    label: 'rty123',
                                                    value: 'rty123',
                                                }
                                            ]
                                        },
                                        {
                                            label: 'rty',
                                            value: 'rty',
                                        }
                                    ]
                                },
                                {
                                    label: '456',
                                    value: '1',
                                    children:[
                                        {
                                            label: '456qwe',
                                            value: '456qwe',
                                        },
                                        {
                                            label: '456rty',
                                            value: '456rty',
                                        }
                                    ]
                                },
                                {
                                    label: '789',
                                    value: '2'
                                }
                            ]
                        },
                        value: '',

                    },
                    {
                        field: 'a5',
                        label: '输入框3',
                        labelWidth: '130px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        // rules: [
                        //     { required: true, message: '请填写活动形式', trigger: 'blur' }
                        // ],
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'textareaInput',
                        attributes:{
                            // disabled: true
                        },
                        value: '',

                    },
                    {
                        field: 'a6',
                        label: '输入框4',
                        labelWidth: '130px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        rules: '',
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'select',
                        attributes: {
                            // disabled:true,
                            options: [
                                {label: '上海', value: 0},
                                {label: '北京', value: 1},
                                {label: '广州', value: 2},
                                {label: '深圳', value: 3}
                            ]
                        },
                        value: 2,

                    },
                    {
                        field: 'a7',
                        label: '输入框5',
                        labelWidth: '130px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        rules: '',
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'radio',
                        attributes: {
                            // disabled:true,
                            options: [
                                {label: '上海'},
                                {label: '北京'},
                                {label: '广州'},
                                {label: '深圳'}
                            ]
                        },
                        value: '上海',

                    },
                    {
                        field: 'a8',
                        label: '输入框6',
                        labelWidth: '130px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        rules: '',
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'checkbox',
                        attributes: {
                            // disabled: true,
                            options: [
                                {label: '上海'},
                                {label: '北京'},
                                {label: '广州'},
                                {label: '深圳'}
                            ]
                        },
                        value: [],

                    },
                    {
                        field: 'a9',
                        label: '输入框7',
                        labelWidth: '130px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        rules: '',
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'datePicker',
                        attributes: {
                            // disabled: true,
                            valueFormat: 'yyyy-MM-dd',
                            type:"daterange",
                            startPlaceholder:"开始日期",
                            endPlaceholder:"结束日期",
                            defaultValue: ['2020-08-01','2020-08-01']
                        },
                        // value: ['2020-08-01','2020-09-21']
                        value: ''
                    },
                    {
                        field: 'a10',
                        label: '输入框8',
                        labelWidth: '130px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        rules: '',
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'cascader',
                        attributes: {
                            // disabled:true,
                            clearable:true,
                            filterable:true,
                            showAllLevels: true,
                            multiple: {
                                multiple: true
                            },
                            options: [
                                {
                                value: 'zhinan',
                                label: '指南',
                                children: [{
                                    value: 'shejiyuanze',
                                    label: '设计原则',
                                    children: [{
                                        value: 'yizhi',
                                        label: '一致'
                                    }, {
                                        value: 'fankui',
                                        label: '反馈'
                                    }, {
                                        value: 'xiaolv',
                                        label: '效率'
                                    }, {
                                        value: 'kekong',
                                        label: '可控'
                                    }]
                                }, {
                                    value: 'daohang',
                                    label: '导航',
                                    children: [{
                                        value: 'cexiangdaohang',
                                        label: '侧向导航'
                                    }, {
                                        value: 'dingbudaohang',
                                        label: '顶部导航'
                                    }]
                                }]
                            }, {
                                value: 'zujian',
                                label: '组件',
                                children: [{
                                    value: 'basic',
                                    label: 'Basic',
                                    children: [{
                                        value: 'layout',
                                        label: 'Layout 布局'
                                    }, {
                                        value: 'color',
                                        label: 'Color 色彩'
                                    }, {
                                        value: 'typography',
                                        label: 'Typography 字体'
                                    }, {
                                        value: 'icon',
                                        label: 'Icon 图标'
                                    }, {
                                        value: 'button',
                                        label: 'Button 按钮'
                                    }]
                                }, {
                                    value: 'form',
                                    label: 'Form',
                                    children: [{
                                        value: 'radio',
                                        label: 'Radio 单选框'
                                    }, {
                                        value: 'checkbox',
                                        label: 'Checkbox 多选框'
                                    }, {
                                        value: 'input',
                                        label: 'Input 输入框'
                                    }, {
                                        value: 'input-number',
                                        label: 'InputNumber 计数器'
                                    }, {
                                        value: 'select',
                                        label: 'Select 选择器'
                                    }, {
                                        value: 'cascader',
                                        label: 'Cascader 级联选择器'
                                    }, {
                                        value: 'switch',
                                        label: 'Switch 开关'
                                    }, {
                                        value: 'slider',
                                        label: 'Slider 滑块'
                                    }, {
                                        value: 'time-picker',
                                        label: 'TimePicker 时间选择器'
                                    }, {
                                        value: 'date-picker',
                                        label: 'DatePicker 日期选择器'
                                    }, {
                                        value: 'datetime-picker',
                                        label: 'DateTimePicker 日期时间选择器'
                                    }, {
                                        value: 'upload',
                                        label: 'Upload 上传'
                                    }, {
                                        value: 'rate',
                                        label: 'Rate 评分'
                                    }, {
                                        value: 'form',
                                        label: 'Form 表单'
                                    }]
                                }, {
                                    value: 'data',
                                    label: 'Data',
                                    children: [{
                                        value: 'table',
                                        label: 'Table 表格'
                                    }, {
                                        value: 'tag',
                                        label: 'Tag 标签'
                                    }, {
                                        value: 'progress',
                                        label: 'Progress 进度条'
                                    }, {
                                        value: 'tree',
                                        label: 'Tree 树形控件'
                                    }, {
                                        value: 'pagination',
                                        label: 'Pagination 分页'
                                    }, {
                                        value: 'badge',
                                        label: 'Badge 标记'
                                    }]
                                }, {
                                    value: 'notice',
                                    label: 'Notice',
                                    children: [{
                                        value: 'alert',
                                        label: 'Alert 警告'
                                    }, {
                                        value: 'loading',
                                        label: 'Loading 加载'
                                    }, {
                                        value: 'message',
                                        label: 'Message 消息提示'
                                    }, {
                                        value: 'message-box',
                                        label: 'MessageBox 弹框'
                                    }, {
                                        value: 'notification',
                                        label: 'Notification 通知'
                                    }]
                                }, {
                                    value: 'navigation',
                                    label: 'Navigation',
                                    children: [{
                                        value: 'menu',
                                        label: 'NavMenu 导航菜单'
                                    }, {
                                        value: 'tabs',
                                        label: 'Tabs 标签页'
                                    }, {
                                        value: 'breadcrumb',
                                        label: 'Breadcrumb 面包屑'
                                    }, {
                                        value: 'dropdown',
                                        label: 'Dropdown 下拉菜单'
                                    }, {
                                        value: 'steps',
                                        label: 'Steps 步骤条'
                                    }]
                                }, {
                                    value: 'others',
                                    label: 'Others',
                                    children: [{
                                        value: 'dialog',
                                        label: 'Dialog 对话框'
                                    }, {
                                        value: 'tooltip',
                                        label: 'Tooltip 文字提示'
                                    }, {
                                        value: 'popover',
                                        label: 'Popover 弹出框'
                                    }, {
                                        value: 'card',
                                        label: 'Card 卡片'
                                    }, {
                                        value: 'carousel',
                                        label: 'Carousel 走马灯'
                                    }, {
                                        value: 'collapse',
                                        label: 'Collapse 折叠面板'
                                    }]
                                }]
                            }, {
                                value: 'ziyuan',
                                label: '资源',
                                children: [{
                                    value: 'axure',
                                    label: 'Axure Components'
                                }, {
                                    value: 'sketch',
                                    label: 'Sketch Templates'
                                }, {
                                    value: 'jiaohu',
                                    label: '组件交互文档'
                                }]
                            }]
                        },
                        value: ''

                    },
                    {
                        field: 'a13',
                        label: '输入框-13',
                        labelWidth: '130px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'switch',
                        attributes:{
                            options:[],
                            // disabled:true
                        },
                        value: true
                    },
                    {
                        field: 'a11',
                        label: '',
                        labelWidth: '0px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        rules: '',
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'button',
                        options:[
                            {
                                value: '0',
                                label: '查看',
                                attributes: {
                                    type:"",
                                    // disabled: false
                                },
                            },
                            {
                                value: '1',
                                label: '编辑',
                                attributes: {
                                    type:"plain",
                                    // disabled: false
                                },
                            }
                        ],
                        // value: ['2020-08-01','2020-09-21']
                        attributes:{
                            // disabled: false
                        },
                        value: ''
                    },
                    {
                        field: 'a12',
                        label: '',
                        labelWidth: '0px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        rules: '',
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'button',
                        options:[
                            {
                                value: '3',
                                label: '查看',
                                attributes: {
                                    type:"",
                                    disabled: false
                                },
                            },
                            {
                                value: '4',
                                label: '编辑',
                                attributes: {
                                    type:"plain",
                                    disabled: false
                                },
                            }
                        ],
                        // value: ['2020-08-01','2020-09-21']
                        attributes:{
                            disabled: false
                        },
                        value: ''
                    },
                    {
                        field: 'a14',
                        label: '输入框-14',
                        labelWidth: '130px',
                        rowSpan: [24, 24, 24, 12, 12],
                        required: '',
                        error: '',
                        showMessage: '',
                        inlineMessag: '',
                        size: '',
                        type: 'image',
                        attributes:{
                            style:'width: 100px; height: 100px',
                            lazy: false,
                            preview: true
                        },
                        value: ['https://xh-aq.fuyitianjian.cn/upload/aq/shxhwjw/22/096099ef7d40450a902a64f8b11ca362/08bdc4488c2443ffa6f1ff104cd5fbd6.jpg']
                    },
                ],

                dialogTableVisible: false,
                dialogFormVisible: false,
                dialogVisible: false
            }
        },
        methods: {
            onSubmit(data){
                console.log(data);
                let newData = JSON.parse(JSON.stringify(this.formItem));
                let type = newData.every(function(item){if(item.field){return item}});
                let data_field = type ? {} : [];
                newData.forEach(function (item) {
                    if (type) {
                        data_field[item.field] = item.value;
                    }else{
                        data_field.push(item.value)
                    }
                });
                if(this.$refs.formItem.validates()){
                   return
                    // alert(' 请填写完整')
                }else{
                    alert(JSON.stringify(data_field))
                }
            },
            resetBtn(){
                this.formKey = new Date().getTime();
                let clearData = this.formItem;
                clearData.forEach((item)=>{
                    item.value = ''
                });
                this.formItem = clearData;
            },
            /*// 校验用户输入名称
            validateName1 (rule, value, callback){
                console.log('23423443')
                console.log(rule, value, callback);
                if (!this.formItem[0].value) {
                    callback(new Error('请输入'));
                }
            },*/
            // 校验用户输入
            validateName (rule, value, callback){
                // console.log(rule, value, callback);
                // console.log(this.formItem)
                let formItem = this.formItem;
                let arr = [];
                arr = formItem.filter(item => {
                    if(item.prop){
                        return rule.fullField === item.prop
                    }
                });
                if (!arr[0].value) {
                    formItem.forEach(item => {
                        if(item.prop === rule.fullField){
                            item.validate = true;
                            item.validateMessage = rule.message;
                        }else{
                            item.validate = false;
                            item.validateMessage = '';
                        }
                    });
                    this.formItem = formItem;
                    callback(new Error());
                }
            },
            submitForm() {
                this.$refs['ruleForm'].validate((valid) => {
                    if (valid) {
                        alert('submit!');
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
            //获取table表格数据
            getTableData(data) {
                console.log({...data});

            },
            //获取from表单数据
            getFormData(data) {
                console.log({...data})
                // if(this.$refs.formItem.validates()){
                //     return
                // }
            },



            //普通弹框显示
            modalDialogVisibleBtn(){
                this.dialogVisible = true;
            },
            //普通弹框隐藏
            modalDialogVisible(){
                this.dialogVisible = false;

            },
            //普通弹框获取数据
            modalDialogData(data){
                this.dialogVisible = false;
                console.log({...data})
                // this.$refs.tableText.toggleSelection(); // 调用子组件的方法清除多选择
            },


            //table弹框显示
            dialogTableVisibleBtn() {
                console.log('table弹框显示')
                this.dialogTableVisible = true;
                this.key = new Date().getTime();
                this.formItem[8].value = ['2020-08-01','2020-09-21'];
                console.log(this.formItem)
            },
            //table弹框隐藏
            modalTableVisible(data) {
                this.dialogTableVisible = false;
                console.log({...data})
            },
            //table获取弹框数据
            modalTableData(data) {
                console.log({...data})
            },


            //form弹框显示
            dialogFormVisibleBtn() {
                this.dialogFormVisible = true;
            },
            //form弹框隐藏
            modalFormVisible(data) {
                this.dialogFormVisible = false;
                console.log({...data})
            },
            //form获取弹框数据
            modalFormData(data) {
                console.log({...data})
                // this.dialogFormVisible = false;
            },



            getStringInputFocus(data){
                console.log({...data})
                this.dialogTableVisible = true;
            },
            getStringInputFocusForm(data){
                console.log({...data})
                this.dialogTableVisible = true;
            },

            //合并单元格
            spanMethod({rowIndex, columnIndex}){
                // let that = this;
                // console.log(that.gridData)
                // console.log(row, column, rowIndex, columnIndex);
                // console.log('spanMethod')
                if (this.gridData.length - 1 == rowIndex) {
                    if (columnIndex === 0) {
                        return [1, 3];
                    } else if (columnIndex === 1) {
                        return [0, 0];
                    } else if (columnIndex === 2) {
                        return [0, 0];
                    } else if (columnIndex === 5) {
                        return [1, 3];
                    } else if (columnIndex === 6) {
                        return [0, 0];
                    } else if (columnIndex === 7) {
                        return [0, 0];
                    }
                }
            },
            rowClassName({row, rowIndex}) {
                console.log('rowClassName:rowClassName:rowClassName:',row,rowIndex)
                if (rowIndex === 1) {
                    return 'warning-row';
                } else if (rowIndex === 3) {
                    return 'success-row';
                }
                return '';
            },
            handleTableCurrentChange(data){
                console.log('handleTableCurrentChange:::',{...data});

            },
            selectionTables({row, index}){
                console.log('selectionTables:',row,index)
                if (index === 1) {
                    return false;
                }else{
                    return true
                }
            },
            cutImageBase64 (file,id,wid,quality,callback=()=>{}){
                var URL = window.URL || window.webkitURL
                var blob = URL.createObjectURL(file)
                var base64
                var img = new Image()
                img.src = blob
                img.onload = function() {
                    var that = this
                    //生成比例
                    var w = that.width,
                        h = that.height,
                        scale = w / h
                    w = wid || w
                    h = w / scale
                    //生成canvas
                    var canvas = document.createElement('canvas')
                    var ctx = canvas.getContext('2d')
                    canvas.setAttribute('width',w)
                    canvas.setAttribute('height',h)
                    ctx.drawImage(that, 0, 0, w, h)
                    // 生成base64
                    base64 = canvas.toDataURL('image/jpeg', quality || 0.8)
                    callback(base64)
                }
            },
            convertBase64UrlToBlob (urlData){
                let arr = urlData.split(','), mime = arr[0].match(/:(.*?);/)[1]
                let bstr = atob(arr[1])
                let n = bstr.length
                let u8arr = new Uint8Array(n)
                while (n--) {
                    u8arr[n] = bstr.charCodeAt(n)
                }
                return new Blob([u8arr], { type: mime })
            }

        }
    }
</script>

<style>
    #app {
        font-family: 'Avenir', Helvetica, Arial, sans-serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-align: center;
        color: #2c3e50;
        margin-top: 60px;
    }
    .el-table .warning-row {
        background: oldlace;
    }

    .el-table .success-row {
        background: #f0f9eb;
    }
</style>
